Skip to content

8383809: [type-classes] Prototype UInt128#2420

Closed
rgiulietti wants to merge 2 commits into
openjdk:type-classesfrom
rgiulietti:8383809
Closed

8383809: [type-classes] Prototype UInt128#2420
rgiulietti wants to merge 2 commits into
openjdk:type-classesfrom
rgiulietti:8383809

Conversation

@rgiulietti
Copy link
Copy Markdown
Contributor

@rgiulietti rgiulietti commented May 11, 2026

Prototype a fully functional unsigned int128 type as a Valhalla value class.



Progress

  • Change must not contain extraneous whitespace

Issue

  • JDK-8383809: [type-classes] Prototype UInt128 (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/valhalla.git pull/2420/head:pull/2420
$ git checkout pull/2420

Update a local copy of the PR:
$ git checkout pull/2420
$ git pull https://git.openjdk.org/valhalla.git pull/2420/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2420

View PR using the GUI difftool:
$ git pr show -t 2420

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/2420.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper Bot commented May 11, 2026

👋 Welcome back rgiulietti! A progress list of the required criteria for merging this PR into type-classes will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link
Copy Markdown

openjdk Bot commented May 11, 2026

@rgiulietti This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8383809: [type-classes] Prototype UInt128

Reviewed-by: darcy

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been no new commits pushed to the type-classes branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@jddarcy) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk Bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 11, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge Bot commented May 11, 2026

Webrevs

@rgiulietti
Copy link
Copy Markdown
Contributor Author

Subject to change and discussion:

  • Use of factory methods rather than constructors.
  • Adding/changing/removing functionality (e.g., adding rotateLeft()).
  • Adding more general *Exact() methods that throw on overflow.
  • Use of typeclass mechanisms.

/**
* Returns the instance representing {@code v}.
*
* @param v must meet 0 ≤ {@code v} &lt; 2<sup>{@link #SIZE}</sup>.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a small issue, I don't know if having "<=" as a single character, as it seems to be here, goes against general encoding rules for JDK sources.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JDK source code has switched to UTF-8 some time ago.

* @param y the 2nd parameter
* @return the result described above.
*/
static boolean lessThan(long x, long y) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional that this method is not public?

Having a @see link to Long.compareUnsigned, if the obvious relationship between the methods holds, would be helpful.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is that the public API point is compareTo().
But it's no deal to make the static comparison methods public as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I know see what you mean.
Addressed in new commit.

@rgiulietti
Copy link
Copy Markdown
Contributor Author

There's a jshell related failure in CompletionSuggestionTest::testGeneric, but seems unrelated to the changes in this PR.

@rgiulietti
Copy link
Copy Markdown
Contributor Author

/integrate

@openjdk openjdk Bot added the sponsor Pull request is ready to be sponsored label May 20, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented May 20, 2026

@rgiulietti
Your change (at version 468b85c) is now ready to be sponsored by a Committer.

Comment on lines +307 to +313
if (lc == 'x') {
return parse(s, i, end, i, 16, '_', -1);
}
if (lc == 'b') {
return parse(s, i, end, i, 2, '_', -1);
}
return parse(s, begin, end, i, 8, '_', c);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be a pattern matching switch:

		return switch (lc) {
			case 'x' -> parse(s, i, end, i, 16, '_', -1);
			case 'b' -> parse(s, i, end, i, 2, '_', -1);
			default -> parse(s, begin, end, i, 8, '_', c;
		};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed.
Maybe in a followup PR.
Thanks

@jddarcy
Copy link
Copy Markdown
Member

jddarcy commented May 22, 2026

/sponsor

@openjdk
Copy link
Copy Markdown

openjdk Bot commented May 22, 2026

Going to push as commit 628aacc.

@openjdk openjdk Bot added the integrated Pull request has been integrated label May 22, 2026
@openjdk openjdk Bot closed this May 22, 2026
@openjdk openjdk Bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels May 22, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented May 22, 2026

@jddarcy @rgiulietti Pushed as commit 628aacc.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants